home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr01 / halcn305.zip / TESTPICK.PAS < prev    next >
Pascal/Delphi Source File  |  1993-07-27  |  3KB  |  109 lines

  1. program TestPick;
  2. {------------------------------------------------------------------------------
  3.                               DBase File Lister
  4.  
  5.        TESTPICK.PAS Copyright (c)  Richard F. Griffin
  6.  
  7.        20 July 1993
  8.  
  9.        102 Molded Stone Pl
  10.        Warner Robins, GA  31088
  11.  
  12.        -------------------------------------------------------------
  13.        This program demonstrates how dBase records may be selected using
  14.        pick menus in Griffin Solutions units.
  15.  
  16.        See SHOWOFF.PAS for additional examples.
  17.  
  18.        ---  WILL NOT RUN UNDER WINDOWS ---
  19.  
  20. -------------------------------------------------------------------------------}
  21.  
  22. uses
  23.    GSOBShel,
  24.    GSOB_DBS,
  25.    GSOB_Inx,
  26.    GSOB_Str,
  27.    GSOB_Var,
  28.    SmplStuf,
  29.    CRT,
  30.    DOS;
  31.  
  32. var
  33.    SelectLine: GSO_dbTable;
  34.    LinItem   : longint;
  35.    slct      : word;
  36.  
  37. Procedure InitializeScreen;
  38. begin
  39.    Window(1,1,80,25);
  40.    SetScreenColors(Yellow,White,Blue,Black,LightGray);
  41.    SetNmMode;
  42.    ClrScr;
  43. end;
  44.  
  45. Procedure DisplayDataLine(x,y : integer; s1,s2 : string);
  46. begin
  47.    GoToXY(x,y);
  48.    SetHiMode;
  49.    write(s1);
  50.    SetNmMode;
  51.    write(s2);
  52. end;
  53.  
  54. Procedure DisplayCurRecord;
  55. begin
  56.    InitializeScreen;
  57.    DisplayDataLine(5,2,'Customer ID: ',FieldGet('UNIQUEID'));
  58.    DisplayDataLine(5,3,'Last Name of Selectee: ',FieldGet('LASTNAME'));
  59.    DisplayDataLine(5,4,'First Name: ',FieldGet('FIRSTNAME'));
  60.    DisplayDataLine(5,6,'Street Address: ',FieldGet('STREET'));
  61.    DisplayDataLine(5,7,'City: ',FieldGet('City'));
  62.    DisplayDataLine(42,7,'State: ',FieldGet('State'));
  63.    DisplayDataLine(54,7,'Zip: ',FieldGet('Zip'));
  64.    DisplayDataLine(5,8,'Telephone Number: ',FieldGet('TELEPHONE'));
  65.    DisplayDataLine(5,9,'Date of Birth: ',StringGet('BIRTHDATE'));
  66.    DisplayDataLine(5,10,'Payment Amount: ',FieldGet('PAYMENT'));
  67. end;
  68.  
  69. Function SelectRecord: longint;
  70. var
  71.    mItem: GSP_IndxEtry;
  72. begin
  73.    window(10,5,70,22);
  74.    SetScreenColors(Black,Yellow,Green,White,Green);
  75.    SetNmMode;
  76.    ClrScr;
  77.    MakeABox('Select Name');
  78.    mItem := GS_Pick_Row(@SelectLine,slct);
  79.    if mItem <> nil then
  80.       SelectRecord := mItem^.Tag
  81.    else
  82.       SelectRecord := 0;
  83. end;
  84.  
  85. begin
  86.    InitializeScreen;
  87.    slct := 1;                     {Initial menu item to highlight}
  88.    Select(1);                     {Use record area 1 (the default)}
  89.    Use('GSDMO_01');               {Assign the dBase III file GSDMO_01}
  90.  
  91.    {  Initialize the SelectLine object and build a table of the
  92.       LASTNAME+FIRSTNAME record fields                          }
  93.  
  94.    SelectLine.Init(DBFActive^,'LASTNAME + FIRSTNAME',SortUp);
  95.    SelectLine.Build_dBTabl;
  96.  
  97.    repeat
  98.       LinItem := SelectRecord;    {Select a name field to be displayed}
  99.       if LinItem > 0 then
  100.       begin
  101.          Go(LinItem);
  102.          DisplayCurRecord;
  103.          WaitForKey;
  104.       end;
  105.    until LinItem = 0;
  106.    InitializeScreen;
  107.    CloseDataBases;                {Close the file}
  108. end.
  109.